package com.codingvip.tree;

import com.codingvip.tree.util.TreePrintUtil;

/**
 * @author hansongtao
 */
public class CodeNode implements TreePrintUtil.TreeNode {
    private int data;
    public CodeNode left;
    public CodeNode right;

    public CodeNode() {
        data = -1;
        left = null;
        right = null;
    }


    public CodeNode(int value) {
        this.data = value;
    }

    public CodeNode(int value, CodeNode leftNode, CodeNode rightNode) {
        this.data = value;
        this.left = leftNode;
        this.right = rightNode;
    }

    public int getData() {
        return data;
    }

    public void setData(int data) {
        this.data = data;
    }

    public CodeNode getLeft() {
        return left;
    }

    public void setLeft(CodeNode left) {
        this.left = left;
    }

    public CodeNode getRight() {
        return right;
    }

    public void setRight(CodeNode right) {
        this.right = right;
    }

    @Override
    public String toString() {
        return "[" + data + "]";
    }

    @Override
    public String getPrintInfo() {
        return toString();
    }

    @Override
    public TreePrintUtil.TreeNode getLeftChild() {
        return left;
    }

    @Override
    public TreePrintUtil.TreeNode getRightChild() {
        return right;
    }


}
